home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / NeoIntroPP3.0 folder / PowerPlant / NeoBench / Source / CFiller.cp next >
Encoding:
Text File  |  1994-09-29  |  1.4 KB  |  66 lines  |  [TEXT/MMCC]

  1. /************************************************************
  2.  *
  3.  *    Created: Tuesday, March 29, 1994 2:55:51 PM
  4.  *    CFiller.cp
  5.  *    Implementation of a dummy persistent object class
  6.  *
  7.  *
  8.  *    Copyright © Neologic Systems 1992-1994. All Rights Reserved.
  9.  *    All rights reserved
  10.  *
  11.  ***********************************************************/
  12.  
  13. #include "NeoTypes.h"
  14. #include CNeoStreamH
  15. #include "CFiller.h"
  16.  
  17. long            CFiller::FFileLength    = kNeoPersistFileLength;
  18. static char        GBuffer[kFillerMaxLength];
  19.  
  20. CNeoPersist *CFiller::New(void)
  21. {
  22.     return new CFiller;
  23. }
  24.  
  25. NeoID CFiller::getClassID(void) const
  26. {
  27.     return kFillerID;
  28. }
  29.  
  30. long CFiller::getFileLength(void) const
  31. {
  32.     return FFileLength;
  33. }
  34.  
  35. #pragma segment NeoRead
  36. void CFiller::readObject(CNeoStream *aStream, const NeoTag aTag)
  37. {
  38.     inherited::readObject(aStream, aTag);
  39.  
  40.     if (FFileLength - kNeoPersistFileLength > 0)
  41.         aStream->readChunk(GBuffer, FFileLength - kNeoPersistFileLength);
  42. }
  43.  
  44. #pragma segment NeoWrite
  45. void CFiller::writeObject(CNeoStream *aStream, const NeoTag aTag)
  46. {
  47.     inherited::writeObject(aStream, aTag);
  48.  
  49.     if (FFileLength - kNeoPersistFileLength > 0)
  50.         aStream->writeChunk(GBuffer, FFileLength - kNeoPersistFileLength);
  51. }
  52.  
  53.                         /** Variable Length Methods **/
  54. long CFiller::SetLength(const long aLength)
  55. {
  56.     if (aLength < kNeoPersistFileLength)
  57.         FFileLength = kNeoPersistFileLength;
  58.     else if (aLength > kFillerMaxLength)
  59.         FFileLength = kFillerMaxLength;
  60.     else
  61.         FFileLength = aLength;
  62.  
  63.     return FFileLength;
  64. }
  65.  
  66.